/**
 * Created with IntelliJ IDEA
 * Description:
 * User:恋恋
 * Date:2022-09-06
 * Time:9:21
 */
class Student {
    public String name;
    public int age;
    public int height;

    public static String classic="物联4班";
    public static void fun(){
        classic="2020级物联4班";
        System.out.println(classic);
    }
    {//构造代码块
        this.name="chen";
        this.age=20;
        this.height=162;
        System.out.println("这是实例代码块");
    }
    static {
        System.out.println("这是静态代码块");
    }
    public Student(){
        System.out.println("无参数的构造方法！");
    }
//    public void work(){
//        int old;
//        System.out.println("上课");
////        System.out.println(old);
//    }
//
//    public Student(String name, int age, int height) {
//        this.name = name;
//        this.age = age;
//        this.height = height;
//
//    }
//
// this("chen",20,162);//this调用其他构造方法时，必须放在第一条语句

//    public Student(String name,int age,int height){
//        this.name=name;
//        this.age=age;
//        this.height=height;
//        System.out.println("有参数的构造方法！");
//        System.out.println(name+"的年龄"+age+"和身高"+height);
//    }
//    public void getting(Student this,String name,int age,int height)
//    {
//        this.name=name;
//        this.age=age;
//        this.height=height;
//        System.out.println("在getting中打印变量:");
//        System.out.println(name+"的年龄"+age+"和身高"+height);
//    }
    public void print(){
        System.out.println("在print中打印变量:");
        System.out.println(this.name+"的年龄"+this.age+"和身高"+this.height);
    }
    public static void main(String[] args) {
        Student stu1=new Student();
        System.out.println("----------------------------------");
        Student stu2=new Student();
//        System.out.println(Student.classic);
//        System.out.println(stu1.classic);
//        stu1.getting("chen",20,162);
//        stu1.print();
    }
}
